17. 解决方案:读写文件
练习解决方案:《飞翔的马戏团》演员名单
def create_cast_list(filename):
cast_list = []
# use with to open the file filename
with open(filename) as f:
# use the for loop syntax to process each line
# and add the actor name to cast_list
for line in f:
line_data = line.split(',')
cast_list.append(line_data[0])
return cast_list